package com.whut.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.whut.common.ReportCommonFunc;
import com.whut.mapper.MeasureresultMapper;
import com.whut.mapper.NewmeasureresultMapper;
import com.whut.mapper.NewmeasureresulttypeMapper;
import com.whut.mapper.NewmeasuresystemMapper;
import com.whut.model.*;
import com.whut.parMapper.utils.MapperUtils;
import com.whut.service.ActualMeasureService;
import com.whut.utils.FileUtil;
import com.whut.utils.MDoc;
import com.whut.utils.NewMeasureTypeCalculationUtil;
import com.whut.v_model.MeasureResultData;
import com.whut.v_model.Point;
import com.whut.model.Measuretablerecord;
import com.whut.v_model.PointGroup;
import com.whut.v_vo.GroupPointVO;
import com.whut.v_vo.MeasureDataVO;
import com.whut.v_vo.PointVO;
import com.whut.v_vo.newMeasuretable;
import org.apache.commons.beanutils.BeanMap;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @auther wenyihan
 * 生成实测实量表
 * @date 15:39 2019/9/8
 * @param
 * @return
*/
@Service("actualMeasureService")
public class ActualMeasureImpl implements ActualMeasureService {
    @Resource
    private MeasureresultMapper measureresultMapper;
    @Resource
    private NewmeasureresultMapper newmeasureresultMapper;
    @Resource
    private NewmeasureresulttypeMapper newmeasureresulttypeMapper;
    @Resource
    private NewmeasuresystemMapper newmeasuresystemMapper;
    @Resource
    private AndroidServiceImpl androidServiceImpl;
    @Resource
    private MapperUtils mapperUtils;
    @Resource
    private UrlProperties urlProperties;
    @Override

    public String newMeasureReport(String recordId, String checkId , String projectId)throws UnsupportedEncodingException{
        Map<String ,Object> dataMap =new HashMap<>();
        Newmeasureresult resultInfo = newmeasureresultMapper.getResultByResultTypeId(recordId,projectId,checkId);
        Newmeasureresulttype typeInfo = newmeasureresulttypeMapper.selectByPrimaryKey(Integer.parseInt(recordId));
        //获取基础信息
        basicInfo(recordId, checkId , projectId , dataMap);
        //获取分数信息
        List<List<GroupPointVO>> groupPointVOS = new ArrayList<>();
        List<MeasureDataVO> measureDataVOS = new ArrayList<>() ;
        Integer modelType = resultInfo.getType();
        switch (modelType) {
            case 0: {
                groupPointVOS = androidServiceImpl.calcType1(Integer.parseInt(recordId),projectId,checkId);
                groupPointVOS.forEach(e -> measureDataVOS.add(NewMeasureTypeCalculationUtil.type1(e, typeInfo.getRangeMath())));
                break;
            }
            case 1: {
                groupPointVOS = androidServiceImpl.calcType2(Integer.parseInt(recordId),projectId,checkId);
                groupPointVOS.forEach(e -> measureDataVOS.add(NewMeasureTypeCalculationUtil.type2(e, typeInfo.getRangeMath())));
                break;
            }
            case 2: {
                groupPointVOS = androidServiceImpl.calcType3(Integer.parseInt(recordId),projectId,checkId);
                groupPointVOS.forEach(e -> measureDataVOS.add(NewMeasureTypeCalculationUtil.type3(e, typeInfo.getRangeMath(), typeInfo.getBurstValue())));
                break;
            }
            case 3: {
                groupPointVOS = androidServiceImpl.calcType4(Integer.parseInt(recordId),projectId,checkId);
                groupPointVOS.forEach(e -> measureDataVOS.add(NewMeasureTypeCalculationUtil.type4And5(e, typeInfo.getRangeMath())));
                break;
            }
            case 4: {
                groupPointVOS = androidServiceImpl.calcType5(Integer.parseInt(recordId),projectId,checkId);
                groupPointVOS.forEach(e -> measureDataVOS.add(NewMeasureTypeCalculationUtil.type4And5(e, typeInfo.getRangeMath())));
                break;
            }
            case 5: {
                groupPointVOS = androidServiceImpl.calcType6(Integer.parseInt(recordId),projectId,checkId);
                groupPointVOS.forEach(e -> measureDataVOS.add(NewMeasureTypeCalculationUtil.type6(e, typeInfo.getRangeMath(), typeInfo.getBurstValue())));
                break;
            }
            case 6: {
                groupPointVOS = androidServiceImpl.calcType7(Integer.parseInt(recordId),projectId,checkId);
                groupPointVOS.forEach(e -> measureDataVOS.add(NewMeasureTypeCalculationUtil.type7(e, typeInfo.getRangeMath())));
                break;
            }
            case 7: {
                groupPointVOS = androidServiceImpl.calcType8(Integer.parseInt(recordId),projectId,checkId);
                groupPointVOS.forEach(e -> measureDataVOS.add(NewMeasureTypeCalculationUtil.type8(e, typeInfo.getRangeMath())));
                break;
            }
            case 8: {
                groupPointVOS = androidServiceImpl.calcType9(Integer.parseInt(recordId),projectId,checkId);
                groupPointVOS.forEach(e -> measureDataVOS.add(NewMeasureTypeCalculationUtil.type4And5(e, typeInfo.getRangeMath())));
                break;
            }
            case 9: {
                groupPointVOS = androidServiceImpl.calcType10(Integer.parseInt(recordId),projectId,checkId);
                groupPointVOS.forEach(e -> measureDataVOS.add(NewMeasureTypeCalculationUtil.type10(e, typeInfo.getRangeMath())));
                break;
            }
            case 10: {
                groupPointVOS = androidServiceImpl.calcType11(Integer.parseInt(recordId),projectId,checkId);
                groupPointVOS.forEach(e -> measureDataVOS.add(NewMeasureTypeCalculationUtil.type4And5(e, typeInfo.getRangeMath())));
                break;
            }
            case 11: {
                groupPointVOS = androidServiceImpl.calcType12(Integer.parseInt(recordId),projectId,checkId);
                groupPointVOS.forEach(e -> measureDataVOS.add(NewMeasureTypeCalculationUtil.type12(e, typeInfo.getRangeMath())));
                break;
            }
        }
        String checkPoints=measureDataVOS.size()+"";
        List<newMeasuretable>  newMeasuretableList = new ArrayList<>();//存放实测值，设计值，偏差值
        for(List<GroupPointVO> gpList: groupPointVOS){
            newMeasuretable newMeasuretable = new newMeasuretable();
            GroupPointVO gp=gpList.get(0);
            List<PointVO> pointVOList = gp.getGroupData();
            newMeasuretable.setMeasurePointList(pointVOList);
            newMeasuretable.setDesignValue(gp.getDesignValue());
            Double depart =0d;
            for (int i = 0; i< pointVOList.size() ; i++){
                Double point = pointVOList.get(i).getDeviation();
                if (point < 0d){
                    point = 0d-point;
                }
                if (i==0){
                    depart = point;
                }else { depart=point>depart? point : depart;
                    newMeasuretable.setDeviation(pointVOList.get(i).getDeviation());
                }
            }
            newMeasuretableList.add(newMeasuretable);
        }
        dataMap.put("checkPoints",checkPoints);
        int i = 1;//设计值和差值
        int j = 1;//实测值
        //填入已有的数据
        for (newMeasuretable measureData: newMeasuretableList){

            dataMap.put("deviation"+i,measureData.getDeviation());
            dataMap.put("dValue"+i,measureData.getDesignValue());
            for (PointVO pointVO:measureData.getMeasurePointList()){
                dataMap.put("amValue"+j,pointVO.getMeasureValue());
                j++;
            }
            i++;
        }
        //填入没有的数据
//        while (i<Integer.parseInt(typeInfo.getCheckPoints())){
        while (i-1<60){
            dataMap.put("deviation"+i,"");
            dataMap.put("dValue"+i,"");
            if (j>i){
                dataMap.put("amValue"+j,"");
                j++;
            }
            dataMap.put("amValue"+j,"");
            j++;
            i++;
        }
        String ftlName = "measureReport//"+typeInfo.getmKey().toString();
//        String ftlName = "measureReport//1010";
        return ReportCommonFunc.generateReport(dataMap, dataMap.get("reportName").toString(), ftlName);
    }

    public void basicInfo(String recordId, String checkId , String projectId, Map dataMap){
        Newmeasureresult resultInfo = newmeasureresultMapper.getResultByResultTypeId(recordId,projectId,checkId);
        Newmeasureresulttype typeInfo = newmeasureresulttypeMapper.selectByPrimaryKey(Integer.parseInt(recordId));
        String projectName = mapperUtils.getContractTaskProjectMapper().getProjectNameByProjectId(Integer.parseInt(projectId));
        String pName4= resultInfo.getCheckPart();
        String checkPart = resultInfo.getCheckPart();
        String pName3 = newmeasureresultMapper.getNode3Name(recordId);
        String rangeName = typeInfo.getRangeName();
        String date = resultInfo.getCheckTime();
        String[] splitDate = date.split(" ");
        date = splitDate[0];
        JSONObject jsonObject = JSONObject.parseObject(resultInfo.getPoint());
        String qualifiedRate =jsonObject.getString("合格率");
        dataMap.put("projectName",projectName);
        dataMap.put("checkPart",checkPart);
        dataMap.put("pName4",pName4);
        dataMap.put("pName3",pName3);
        dataMap.put("rangeName",rangeName);
        dataMap.put("date",date);
        dataMap.put("qualifiedRate",qualifiedRate);
        DateTimeFormatter dateTime = DateTimeFormatter.ofPattern("yyyyMMddhhmmss");
        String fileNameTime = dateTime.format(LocalDateTime.now());
        String reportName = projectName.replace('#','号')+pName4 + fileNameTime;
        dataMap.put("reportName",reportName);
    }

    @Override
    public String ftlGetReport(int recordId) throws UnsupportedEncodingException {
        Map<String, Object> dataMap = new HashMap<>();

        List<Measuretablerecord> projectNameList = measureresultMapper.getProjectName(recordId);
        String projectName = JSON.toJSONString(projectNameList, SerializerFeature.WriteMapNullValue);
        JSONArray projectNameArray = JSONArray.parseArray(projectName);
        JSONObject projectNameObject = projectNameArray.getJSONObject(0);
        dataMap.put("projectName", projectNameObject.getString("projectName"));
        dataMap.put("finishTime", projectNameObject.getString("finishTime"));

        List<Measureresult> formDataList = measureresultMapper.getFromData(recordId);

        int n = 0; //检查部位 checkP percent pointN
        int t = 0; //评判标准 checkT rangeM
        int g = 0; //pointData scD jsD pcD
        int m = 0; //sjD jsD(type == 2)
        int type = 0;
        for (Measureresult mr: formDataList) {
            type = mr.getType();
            n++;
            if (!mr.getIsEmpty()){
                dataMap.put("checkP"+n, mr.getCheckPart());
                dataMap.put("percent"+n, mr.getQualifiedRate());
                int resultTypeId = mr.getResultTypeId();
                List<Measureresulttype> resultType = measureresultMapper.getResultType(resultTypeId);
                for (Measureresulttype mrt:resultType) {
                    t++;
                    System.out.println("checkT:"+mrt.getParameterName());
                    dataMap.put("checkT" + t, mrt.getParameterName());
                    dataMap.put("rangeM" + t, mrt.getRangeName());
                }

                //pointData
                String pointData = mr.getPointData();
                MeasureResultData measureResultData = JSON.parseObject(pointData, MeasureResultData.class);
                dataMap.put("pointN"+n, measureResultData.getTotalPointNum());

                //groups
                List<PointGroup> groups = measureResultData.getGroups();
                m = 0;
                g = 0;
                for (PointGroup pg: groups) {
                    m++;
                    List<Point> groupData = pg.getGroupData();
                    for (Point p: groupData) {
                        g++;
                        if (type == 0 || type == 1) {
                            dataMap.put("scD"+g, p.getObservedValue());
                            dataMap.put("jsD"+g, p.getOffset());
                            dataMap.put("pcD"+g, p.getOffset());
                            dataMap.put("sjD"+g, pg.getDesignValue());
                            if (n == 1) {
                                dataMap.put("scD"+g+"h", p.getObservedValue());
                                dataMap.put("jsD"+g+"h", p.getOffset());
                                dataMap.put("pcD"+g+"h", p.getOffset());
                                dataMap.put("sjD"+g+"h", pg.getDesignValue());
                            }else if (n == 2) {
                                dataMap.put("scD"+g+"w", p.getObservedValue());
                                dataMap.put("jsD"+g+"w", p.getOffset());
                                dataMap.put("pcD"+g+"w", p.getOffset());
                                dataMap.put("sjD"+g+"w", pg.getDesignValue());
                            }else if (n == 3) {
                                dataMap.put("scD"+g+"z", p.getObservedValue());
                                dataMap.put("jsD"+g+"z", p.getOffset());
                                dataMap.put("pcD"+g+"z", p.getOffset());
                                dataMap.put("sjD"+g+"z", pg.getDesignValue());
                            }else if (n == 4) {
                                dataMap.put("scD"+g+"y", p.getObservedValue());
                                dataMap.put("jsD"+g+"y", p.getOffset());
                                dataMap.put("pcD"+g+"y", p.getOffset());
                                dataMap.put("sjD"+g+"y", pg.getDesignValue());
                            }
                        }else if (type == 2){
                            dataMap.put("scD"+g, p.getObservedValue());
                            dataMap.put("pcD"+g, pg.getMaxOffset());
                            if (n == 1) {
                                dataMap.put("scD"+g+"h", p.getObservedValue());
                                dataMap.put("sjD"+g+"h", pg.getDesignValue());
                                dataMap.put("jsD"+g+"h", pg.getMaxOffset());
                                dataMap.put("pcD"+g+"h", pg.getMaxOffset());
                            }else if (n == 2) {
                                dataMap.put("scD"+g+"w", p.getObservedValue());
                                dataMap.put("sjD"+g+"w", pg.getDesignValue());
                                dataMap.put("jsD"+g+"w", pg.getMaxOffset());
                                dataMap.put("pcD"+g+"w", pg.getMaxOffset());
                            }else if (n == 3) {
                                dataMap.put("scD"+g+"z", p.getObservedValue());
                                dataMap.put("sjD"+g+"z", pg.getDesignValue());
                                dataMap.put("jsD"+g+"z", pg.getMaxOffset());
                                dataMap.put("pcD"+g+"z", pg.getMaxOffset());
                            }else if (n == 4) {
                                dataMap.put("scD"+g+"y", p.getObservedValue());
                                dataMap.put("sjD"+g+"y", pg.getDesignValue());
                                dataMap.put("jsD"+g+"y", pg.getMaxOffset());
                                dataMap.put("pcD"+g+"y", pg.getMaxOffset());
                            }
                        }
                    } // for Point
                    if (type == 2){
                        dataMap.put("sjD"+m, pg.getDesignValue());
                        dataMap.put("jsD"+m, pg.getMaxOffset());
                        if (n == 1) {
                            dataMap.put("sjD"+m+"h", pg.getDesignValue());
                            dataMap.put("jsD"+m+"h", pg.getMaxOffset());
                        }else if (n == 2) {
                            dataMap.put("sjD"+m+"w", pg.getDesignValue());
                            dataMap.put("jsD"+m+"w", pg.getMaxOffset());
                        }else if (n == 3) {
                            dataMap.put("sjD"+m+"z", pg.getDesignValue());
                            dataMap.put("jsD"+m+"z", pg.getMaxOffset());
                        }else if (n == 4) {
                            dataMap.put("sjD"+m+"y", pg.getDesignValue());
                            dataMap.put("jsD"+m+"y", pg.getMaxOffset());
                        }
                    }
                } //for PointGrou
            } else{
                dataMap.put("checkP"+n, "");
                dataMap.put("percent"+n, "");
                int resultTypeId = mr.getResultTypeId();
                List<Measureresulttype> resultType = measureresultMapper.getResultType(resultTypeId);
                for (Measureresulttype mrt:resultType) {
                    t++;
                    dataMap.put("checkT" + t, "");
                    dataMap.put("rangeM" + t, "");
                }

                //pointData
                String pointData = mr.getPointData();
                MeasureResultData measureResultData = JSON.parseObject(pointData, MeasureResultData.class);
                dataMap.put("pointN"+n, "");

                //groups
                for (int o = 0; o < 70 ; o++) {
                    for (int k = 0; k < 70; k++) {
                        if (type == 0 || type == 1){
                            dataMap.put("scD"+k, "");
                            dataMap.put("jsD"+k, "");
                            dataMap.put("pcD"+k, "");
                            dataMap.put("sjD"+k, "");
                            if (n == 1) {
                                dataMap.put("scD"+k+"h", "");
                                dataMap.put("jsD"+k+"h", "");
                                dataMap.put("pcD"+k+"h", "");
                                dataMap.put("sjD"+k+"h", "");
                            }else if (n == 2) {
                                dataMap.put("scD"+k+"w", "");
                                dataMap.put("jsD"+k+"w", "");
                                dataMap.put("pcD"+k+"w", "");
                                dataMap.put("sjD"+k+"w", "");
                            }else if (n == 3) {
                                dataMap.put("scD"+k+"z", "");
                                dataMap.put("jsD"+k+"z", "");
                                dataMap.put("pcD"+k+"z", "");
                                dataMap.put("sjD"+k+"z", "");
                            }else if (n == 4) {
                                dataMap.put("scD"+k+"y", "");
                                dataMap.put("jsD"+k+"y", "");
                                dataMap.put("pcD"+k+"y", "");
                                dataMap.put("sjD"+k+"y", "");
                            }
                        }else if (type == 2){
                            dataMap.put("scD"+k, "");
                            dataMap.put("pcD"+k, "");
                            if (n == 1) {
                                dataMap.put("scD"+k+"h", "");
                                dataMap.put("pcD"+k+"h", "");
                            }else if (n == 2) {
                                dataMap.put("scD"+k+"w", "");
                                dataMap.put("pcD"+k+"w", "");
                            }else if (n == 3) {
                                dataMap.put("scD"+k+"z", "");
                                dataMap.put("pcD"+k+"z", "");
                            }else if (n == 4) {
                                dataMap.put("scD"+k+"y", "");
                                dataMap.put("pcD"+k+"y", "");
                            }
                        }
                    } // for Point
                    if (type == 2){
                        dataMap.put("sjD"+o, "");
                        dataMap.put("jsD"+o, "");
                        if (n == 1) {
                            dataMap.put("sjD"+o+"h", "");
                            dataMap.put("jsD"+o+"h", "");
                        }else if (n == 2) {
                            dataMap.put("sjD"+o+"w", "");
                            dataMap.put("jsD"+o+"w", "");
                        }else if (n == 3) {
                            dataMap.put("sjD"+o+"z", "");
                            dataMap.put("jsD"+o+"z", "");
                        }else if (n == 4) {
                            dataMap.put("sjD"+o+"y", "");
                            dataMap.put("jsD"+o+"y", "");
                        }
                    }
                } //for PointGroup
            } //if isEmpty()
        } //for Measureresult

        //补充填满之后全部的占位符
        for (int i = (n+1); i < 5; i++){
            dataMap.put("checkP"+i, "");
            dataMap.put("percent"+i, "");
            dataMap.put("pointN"+i, "");
        }
        for (int i = (t+1); i < 8; i++){
            dataMap.put("checkT"+i, "");
            dataMap.put("rangeM"+i, "");
        }
        if (type == 2){
            for (int i = (m+1); i < 70; i++){
                dataMap.put("sjD"+i, "");
                dataMap.put("jsD"+i, "");
                dataMap.put("sjD"+i+"h", "");
                dataMap.put("jsD"+i+"h", "");
                dataMap.put("sjD"+i+"w", "");
                dataMap.put("jsD"+i+"w", "");
                dataMap.put("sjD"+i+"z", "");
                dataMap.put("jsD"+i+"z", "");
                dataMap.put("sjD"+i+"y", "");
                dataMap.put("jsD"+i+"y", "");
            }
            for (int i = (g+1); i < 70; i++){
                dataMap.put("scD"+i, "");
                dataMap.put("pcD"+i, "");
                dataMap.put("scD"+i+"h", "");
                dataMap.put("pcD"+i+"h", "");
                dataMap.put("scD"+i+"w", "");
                dataMap.put("pcD"+i+"w", "");
                dataMap.put("scD"+i+"z", "");
                dataMap.put("pcD"+i+"z", "");
                dataMap.put("scD"+i+"y", "");
                dataMap.put("pcD"+i+"y", "");
            }
        } else if (type == 1 || type == 0){
            for (int i = (g+1); i < 70; i++){
                dataMap.put("scD"+i, "");
                dataMap.put("jsD"+i, "");
                dataMap.put("pcD"+i, "");
                dataMap.put("sjD"+i, "");
                dataMap.put("scD"+i+"h", "");
                dataMap.put("jsD"+i+"h", "");
                dataMap.put("pcD"+i+"h", "");
                dataMap.put("sjD"+i+"h", "");
                dataMap.put("scD"+i+"w", "");
                dataMap.put("jsD"+i+"w", "");
                dataMap.put("pcD"+i+"w", "");
                dataMap.put("sjD"+i+"w", "");
                dataMap.put("scD"+i+"z", "");
                dataMap.put("jsD"+i+"z", "");
                dataMap.put("pcD"+i+"z", "");
                dataMap.put("sjD"+i+"z", "");
                dataMap.put("scD"+i+"y", "");
                dataMap.put("jsD"+i+"y", "");
                dataMap.put("pcD"+i+"y", "");
                dataMap.put("sjD"+i+"y", "");
            }
        }
        dataMap.put("checkP", dataMap.get("checkP1"));
        dataMap.put("percent", dataMap.get("percent1"));
        dataMap.put("pointN", dataMap.get("pointN1"));
        dataMap.put("checkT", dataMap.get("checkT1"));
        dataMap.put("rangeM", dataMap.get("rangeM1"));

        System.out.println("dataMap:" + dataMap);

        int mKey = measureresultMapper.getmKey(recordId);
        Date date = new Date();
        DateFormat d1 = new SimpleDateFormat("yyyyMMddhhmmss");
        String fileName = d1.format(date) + mKey;
        MDoc mdoc = new MDoc();
        String path = FileUtil.getServerFolderPath();
        File f1 = new File(path, "doc");
        if (!f1.exists()) {
            f1.mkdirs();
        }
        mdoc.createDoc(dataMap, path + "\\doc\\" + fileName + ".doc", "scslFTL\\"+mKey+".ftl");
        //MDoc.docToDocx("D:\\whutServer\\apache-tomcat-8.5.41\\webapps\\ROOT\\doc\\" + fileName + ".doc", "D:\\whutServer\\apache-tomcat-8.5.41\\webapps\\ROOT\\doc\\" + fileName + ".doc");
        String result = urlProperties.getAddress()+"/doc/" + fileName + ".doc";
        return result;
        /*MDoc mdoc = new MDoc();
        int mKey = measureresultMapper.getmKey(recordId);
        mdoc.createDoc(dataMap, "E:\\tencent_File\\1296928795\\FileRecv\\yirui" + fileName + ".doc", "scslFTL\\"+mKey+".ftl");
        MDoc.docToDocx("E:\\tencent_File\\1296928795\\FileRecv\\yirui" + fileName + ".doc", "E:\\tencent_File\\1296928795\\FileRecv\\yirui" + fileName + ".doc");
        String result = "E:\\tencent_File\\1296928795\\FileRecv\\yirui" + fileName + ".doc";*//*
        int mKey = measureresultMapper.getmKey(recordId);
        Date date = new Date();
        DateFormat d1 = new SimpleDateFormat("yyyyMMddhhmmss");
        String fileName = d1.format(date) + mKey;

        MDoc mdoc = new MDoc();
        String path = FileUtil.getServerFolderPath();
        File f1 = new File(path, "doc");
        if (!f1.exists()) {
            f1.mkdirs();
        }
        mdoc.createDoc(dataMap, path + "\\doc\\" + fileName + ".doc", "scslFTL\\"+mKey+".ftl");
        MDoc.docToDocx("D:\\whutServer\\apache-tomcat-8.5.41\\webapps\\ROOT\\doc\\" + fileName + ".doc", "D:\\whutServer\\apache-tomcat-8.5.41\\webapps\\ROOT\\doc\\" + fileName + ".doc");
        String result = urlProperties.getAddress()+"/doc/" + fileName + ".doc";
        return result;*/

    }
}
